<?php
defined('_JEXEC') or die;
$templatepath	= JURI::base().'templates/'.JFactory::$application->getTemplate();
JHtml::_('behavior.keepalive');
$sess=JFactory::getSession();
if($dat=$sess->get("regs1.data")){
	extract($dat);//all keys become variables
	$kidage=explode(',',$kidage);
	$hvorkg=explode(',',$hvorkg);
}
?>
<style type="text/css">
	form input.invalid{
		background-color: #fdd;
	}
</style>
<script type="text/javascript">
function isValidEmail(str) {

	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);

	return pattern.test(str);

	}
function check()
{
	var tmp=jQuery("#fornave");
	var flg=1;
	if(tmp.val()==''){
			 tmp.addClass('invalid');
			flg=0;
	}
	else
		tmp.removeClass('invalid');
	
	tmp=jQuery("#efternavn");
	if(tmp.val()=='')
	{
			 tmp.addClass('invalid');
			 flg=0;
	}
	else
		tmp.removeClass('invalid');
	
	tmp=jQuery("#alder");
	if(tmp.val()=='')
	{
			 tmp.addClass('invalid');
			 flg=0;
	}
	else
		tmp.removeClass('invalid');
	
	tmp=jQuery("#hojde");
	if(tmp.val()=='')
	{
			 tmp.addClass('invalid');
			 flg=0;
	}
	else
		tmp.removeClass('invalid');
	
	tmp=jQuery("#vagt");
	if(tmp.val()=='')
	{
			 tmp.addClass('invalid');
			 flg=0;
	}
	else
		tmp.removeClass('invalid');
	
	tmp=jQuery("#mobile");
	if(tmp.val()=='')
	{
			 tmp.addClass('invalid');
			 flg=0;
	}
	else
		tmp.removeClass('invalid');
	
	
	tmp=jQuery("#email");
	if(!isValidEmail(tmp.val()))
	{
			 tmp.addClass('invalid');
			 flg=0;
	}
	else
		tmp.removeClass('invalid');
	
	tmp=jQuery("#reemail");
	if( !isValidEmail(tmp.val()) || tmp.val() != jQuery("#email").val() )
	{
			 tmp.addClass('invalid');
			 flg=0;
	}
	else
		tmp.removeClass('invalid');
	
	tmp=jQuery("#password");
	if(tmp.val()=='')
	{
			 tmp.addClass('invalid');
			 flg=0;
	}
	else
		tmp.removeClass('invalid');
	
	tmp=jQuery("#repassword");
	if( tmp.val()=='' || tmp.val() != jQuery("#password").val() )
	{
			 tmp.addClass('invalid');
			 flg=0;
	}
	else
		tmp.removeClass('invalid');
	
	if(flg)
		return true;
	return false;
}
function formvalidate(){
	if(check())
		jQuery('#member-registration').submit();
	return false;
}
</script>
<h2 class="titlepage">Personlige oplysninger</h2>
<h3 class="title-step-page">Personlige oplysninger 1/5</h3>  
<div class="eachBox creater-user-box clearfix"> 
    <div class="cont-box">
        <div class="decs-p">
            <p>Alle felter markeret med *rød stjerne skal besvares – resten er valgfrie. Men vi opfordrer til at udfylde flest mulige felter, da det giver vejlederen mest mulig information inden jeres webmøde.</p>
            <p>Har du nogle spørgsmål eller andet undervejs, er du meget velkommen til at kontakt kundeservice her</p>
        </div>
        <form id="member-registration" method="post" class="form-validate">
        <div class="wrapCreaterUser"> 
            <div class="col-info-1">
                    <div class="eachRow eachInput clearfix"> 
                        <p>Fornavn <span class="red">*</span></p>
                        <input class="txtip" type="text" name="jform[fornavn]" id="fornave" value="<?php echo $fornavn?>" required>
                    </div>
                    <div class="eachRow eachInput clearfix"> 
                        <p>Efternavn  <span class="red">*</span></p>
                        <input class="txtip" type="text" name="jform[efternavn]" id="efternavn" value="<?php echo $efternavn?>" required>
                    </div>
                    <div class="eachRow clearfix"> 
                        <div class="eachInput divi-col divi-1-3 m-l-0">
                            <p>Alder <span class="red">*</span></p>
                            <input class="txtip" type="text" name="jform[alder]" id="alder" value="<?php echo $alder ?: ""?>" required> 
                        </div>
                        <div class="eachInput divi-col divi-1-3">
                            <p>Højde  <span class="red">*</span></p>
                            <input class="txtip" type="text" name="jform[hojde]" id="hojde" value="<?php echo $hojde ?: ""?>" required> 
                        </div> 
                        <div class="eachInput divi-col divi-1-3">
                            <p>Vægt  <span class="red">*</span></p>
                            <input class="txtip" type="text" name="jform[vagt]" id="vagt" value="<?php echo $vagt ?:""?>" required> 
                        </div>  
                    </div>
                    <div class="eachRow clearfix"> 
                        <div class="eachInput divi-col divi-2-3 m-l-0">
                            <p>Ønsker du vægttabeller muskelforøgelse?</p>
                            <select class="select-sl" name="jform[weekdown]" id="mangeuger">
                                <option value="1" <?php if($weekdown==1) echo "selected"?>>Vægttab</option>
                                <option value="2" <?php if($weekdown==2) echo "selected"?>>Muskelforøgelse</option>                
                            </select> 
                        </div>
                        <div class="eachInput divi-col divi-1-3">
                            <p>Hvor mange kg.?</p>
                            <input class="txtip" type="text" name="jform[weightdown]" id="duattabe" value="<?php echo $weightdown ;?>"> 
                        </div>  
                    </div>
                    <div class="eachRow eachInput clearfix"> 
                        <p>Mobiltelefon <span class="red">*</span></p>
                        <input class="txtip" type="text" name="jform[mobile]" id="mobile" value="<?php echo $mobile?>" required>
                    </div>
                    <div class="eachRow eachInput clearfix">                              
                         <p>Skype id  <span class="tool-tip" id="my-tooltip"><img src="templates/fitplan/src_mobile/images/iconTooltip.png"></span></p> 
                        <input class="txtip">
                    </div>
                    <div class="eachRow eachInput clearfix"> 
                        <p>E-mail  <span class="red">*</span></p>
                        <input class="txtip" type="email" name="jform[email]" id="email" value="<?php echo $email?>" required>
                    </div> 
                    <div class="eachRow eachInput clearfix"> 
                        <p>Gentag e-mail   <span class="red">*</span></p>
                        <input class="txtip" type="email" name="reemail" id="reemail" value="<?php echo $email?>" required>
                    </div> 
                    <div class="eachRow eachInput clearfix"> 
                        <p>Kodeord<span class="red">*</span></p>
                        <input class="txtip" type="password" type="password" name="jform[password]" id="password" required>
                    </div>
                    <div class="eachRow eachInput clearfix"> 
                        <p>Gentag kodeord   <span class="red">*</span></p>
                        <input class="txtip" type="password" type="password" name="repassword" id="repassword" required>
                    </div>
            </div><!--col-info-1-->
            <div class="col-info-2">
                    <div class="form-marital-stt">
                        <h6>Din civilstatus:</h6>
                        <br>
                        <label class="blradio"><input class="radioip ra" type="radio" <?php if(!$civilstatus) echo "checked" ?> type="radio" name="jform[civilstatus]" value="">Single</label>
                        <br>
                        <label class="blradio"><input class="radioip ra" <?php if($civilstatus) echo "checked" ?> type="radio" name="jform[civilstatus]" value="1">Har sammenlevende</label>
                        <br>
                        <p>Har du hjemmeboende børn?</p>
                        <p>Hvis ja, hvor mange og hvillken alder?</p>
                            <script type="text/javascript">
                                  jQuery(function(){ 

                                  $("#choicemaker").change(function() {
                                        var count= parseInt($(this).val());
                                        for(i=1;i<=4;i++)
                                            $('#nam'+i+'').hide();  
                                        for(i=1;i<=count;i++)
                                         $('#nam'+i+'').show(); 
                                    });
                                  $("#close_meeting").click(function() {
                                      $("#f-event3").hide();
                                    });
                                  
                                });
                        </script>
                            <select id="choicemaker" name="jform[choicemaker]" class="select-sl">
                                <option value="">Nej</option> 
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                            </select>
                        <div id="w-privat">
                            <div class="eachRow clearfix"> 
                                <div id="nam1" class="eachInput divi-col divi-1-2 m-l-0 <?php if(!$choicemaker) echo 'hide'?>">
                                    <p>Alder på 1. barn (år) </p>
                                    <input class="txtip" type="text" name="jform[kidage][0]" id="text_nam_1" value="<?php echo $kidage[0]?>"> 
                                </div>
                                <div id="nam2" class="eachInput divi-col divi-1-2 <?php if((int)$choicemaker==1 || !$choicemaker) echo ' hide' ?>">
                                    <p>Alder på 2. barn (år)</p>
                                    <input class="txtip" type="text" name="jform[kidage][1]" id="text_nam_2" value="<?php echo $kidage[1]?>"> 
                                </div>  
                            </div>
                            <div class="eachRow clearfix"> 
                                <div  id="nam3" class="eachInput divi-col divi-1-2 m-l-0 <?php if((int)$choicemaker<3 || !$choicemaker) echo 'hide'?>">
                                    <p>Alder på 3. barn (år) </p>
                                    <input class="txtip" type="text" name="jform[kidage][2]" id="text_nam_3" value="<?php echo $kidage[2]?>"> 
                                </div>
                                <div id="nam4" class="eachInput divi-col divi-1-2 <?php if((int)$choicemaker<4 || !$choicemaker) echo ' hide' ?>">
                                    <p>Alder på 4. barn (år) </p>
                                    <input class="txtip" type="text" name="jform[kidage][3]" id="text_nam_4" value="<?php echo $kidage[3]?>"> 
                                </div>  
                            </div> 
                        </div> 

                    </div><!--form-marital-stt-->

                    <div class="form-objective-stt">
                        <h6>Delmål:</h6>
                        <p>Hvor mange kg. ønsker du at tabe?</p>
                        <div class="eachRow clearfix"> 
                            <div class="eachInput divi-col divi-1-2 m-l-0">
                                <p>1. måned (Kg) </p>
                                <input class="txtip" name="jform[hvorkg][0]" id="hvorkg1" value="<?php echo $hvorkg[0]?>"> 
                            </div>
                            <div class="eachInput divi-col divi-1-2">
                                <p>2. måned (Kg) </p>
                                <input class="txtip" name="jform[hvorkg][1]" id="hvorkg2" value="<?php echo $hvorkg[1]?>"> 
                            </div>  
                        </div>
                        <div class="eachRow clearfix"> 
                            <div class="eachInput divi-col divi-1-2 m-l-0">
                                <p>3. måned (Kg) </p>
                                <input class="txtip" name="jform[hvorkg][2]" id="hvorkg3" value="<?php echo $hvorkg[2]?>"> 
                            </div>
                            <div class="eachInput divi-col divi-1-2">
                                <p>4. måned (Kg) </p>
                                <input class="txtip" name="jform[hvorkg][3]" id="hvorkg4" value="<?php echo $hvorkg[3]?>"> 
                            </div>  
                        </div>
                    </div><!--form-objective-stt--> 
            </div><!--col-info-1-->  
        </div><!--wrapCreaterUser-->   
         <div class="wrap-btn-cru clearfix">  
            <a class="btnGreen bntNext right" href="javascript:void(0);" onclick="return formvalidate();"> Næste <span class="iconext"><img src="templates/fitplan/src_mobile/images/iconNext.png"></span></a> 
        </div>
        <input type="hidden" name="option" value="com_users"/>
        <input type="hidden" name="task" value="registration.step1"/>
        <?php echo JHtml::_('form.token');?>
        </form>             
    </div><!-- cont-boX-->   
</div>